package com.wyx.bbs.controller;

import com.wyx.bbs.domain.Article;
import com.wyx.bbs.domain.ThumbsUp;
import com.wyx.bbs.service.ArticleService;
import com.wyx.bbs.service.CommentService;
import com.wyx.bbs.service.ThumbsUpService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * TODO
 * 点赞
 * @Author xiaomao
 * @Date 2021/3/31 22:10
 */
@RestController
@RequestMapping("/agree")
public class ThumbsUpController {

    @Resource
    ThumbsUpService thumbsUpService;


    Map map = new HashMap();
    private Object resultMap(int code, String msg){
        map.put("code",code);
        map.put("msg",msg);
        return map;
    }

    /**
     * 点赞
     * @return
     */
    @RequestMapping(value = "/thumbsUp", method = RequestMethod.POST)
    @ResponseBody
    public Object thumbsUp(@RequestBody ThumbsUp thumbsUp){

        int getThumbsUp = thumbsUpService.addThumbsUp(thumbsUp);
        if(getThumbsUp!=0){
            resultMap(200, "成功");
        }
        return map;
    }


/**
 *
 */
}
